<?php
 /**
  *      [2yyg!] (C)2010-2099 Comsenz Inc.
  *      This is NOT a freeware, use is subject to license terms.
  *      $Id: index.php  2013-06-30 05:34:47Z wangguo $
  */

//网站当前路径(yyy)
define('SITE_PATH', __DIR__."/../");
/*
 * 解析本地环境配置
 */
$env = parse_ini_file(SITE_PATH.'/../.env');
foreach ($env as $key => $value ) {
    putenv($key.'='.$value);
}

/* check env */
if(getenv('RUNTIME_ENVIROMENT')){
    define("APP_ENV", getenv('RUNTIME_ENVIROMENT'));
} else {
    define("APP_ENV", "LOCAL");
}

if (APP_ENV == 'ONLINE') {
    //开启调试模式
    define("APP_DEBUG", FALSE);
} else {
    //开启调试模式
    define("APP_DEBUG", TRUE);
}
if  (APP_DEBUG) {
    //add by gw for debug
    ini_set("display_errors","On");
    // 报告 runtime 错误
    error_reporting(E_ERROR | E_WARNING | E_PARSE);

    /*报告所有错误
    error_reporting(E_ALL);
    */
}

/*
*---------------------------------------------------------------
* SYSTEM BAN BEN TYPE
*---------------------------------------------------------------
*/
 define('G_BANBEN_TYPE', '9aabCQkBVlQABwcEU1wDD1NWUVcCClBaAwcAC1GK3fvfn5besLlKgbis04z5gr+wSoSF3Nmz09657BTWi+KC263Wu7EV19Pv2Jii0+rt');
 /*
 *---------------------------------------------------------------
 * SYSTEM FOLDER NAME
 *---------------------------------------------------------------
 */
$system_path = 'system';

 /*
 *---------------------------------------------------------------
 * STATICS FOLDER NAME
 *---------------------------------------------------------------
 */
$statics_path = 'statics';

//处理微信分享链接
$temp = explode('rom', $_SERVER['QUERY_STRING']);
    $temp = str_replace('?f', '', $temp[0]);
    $_SERVER['QUERY_STRING'] = str_replace('&f', '', $temp);
 /*
 *---------------------------------------------------------------
 * APP START PATH
 *---------------------------------------------------------------
 */
define('G_APP_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR);

/*
 * --------------------------------------------------------------
 * LOAD THE BOOTSTRAP FILE
 * --------------------------------------------------------------
 */
include G_APP_PATH.$system_path.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'global.php';

/*
 * --------------------------------------------------------------
 * APP START
 * --------------------------------------------------------------
 */

System::CreateApp();
